<?php
/**
 * @Author:      ZH
 * @DateTime:  2017-07-13 13:38:30
 * @Description: 金蝶数据
 */
class JinDieFAccountBookInfo extends Eloquent
{
    protected $table = "FAccountBookInfo";

    /**
     * 多账套查询接口
     * UTF-8
     * GET
     * /api/exportAccountBook
     */
    //写入数据库
    public static function storeDataQuery($result){
        foreach($result as $val) {
            $JinDieFAccountBookInfo = JinDieFAccountBookInfo::where('FAccountBookCode',$val->FAccountBookCode)->orderBy('updated_at','desc')->first();
            if(!$JinDieFAccountBookInfo){
                $JinDieFAccountBookInfo = new JinDieFAccountBookInfo();
                $JinDieFAccountBookInfo->created_at = Common::currentTimeString();
            }
            $JinDieFAccountBookInfo->FAccountBookCode = $val->FAccountBookCode;
            $JinDieFAccountBookInfo->FAccountBookName = $val->FAccountBookName;
            try {
                $JinDieFAccountBookInfo->save();
            }catch(Exception $e){

            }
        }
    }
}